package com.raulraja.view.manager.impl;

import com.raulraja.dto.PersonDTO;
import com.raulraja.model.domain.readonly.PersonReadOnly;
import com.raulraja.service.PersonBusinessService;
import com.raulraja.view.manager.PersonViewManager;
import com.raulraja.view.object.PersonVO;

/**
 * Default Person View Manager Impl
 */
public class PersonViewManagerImpl implements PersonViewManager {

	/**
	 * The business services that this handler delegates to
	 */
	private PersonBusinessService personBusinessService;

	/**
	 * @param personBusinessService the person business service
	 */
	public void setPersonBusinessService(PersonBusinessService personBusinessService) {
		this.personBusinessService = personBusinessService;
	}

	/**
	 * @param personDTO a data object containing info to load the person
	 * @return a view object representation of a person
	 */
	public PersonVO getPerson(PersonDTO personDTO) {
		PersonReadOnly personReadOnly = personBusinessService.getActivePerson(personDTO);
		return new PersonVO(personReadOnly);
	}
}
